import { Component,ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams, Slides } from 'ionic-angular';

/**
 * Generated class for the TixianPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-tixian',
  templateUrl: 'tixian.html',
})
export class TixianPage {
  @ViewChild('contentSlides') contentSlides: Slides;

  menus:Array<string> = ["支付宝", "微信", "话费"]
  selectIndex:number = 0;
  dataArr:any;
  objectKeys:any;

  //点击要提现的金额
  moneySelect:number = -1;
  tempData:any
  constructor(public navCtrl: NavController, public navParams: NavParams) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad TixianPage');
    this.dataArr = {
      'zhifubao':{
        'data':[
          {'money':1.00, 'detail':'金额越大越优惠', 'gold':20000},
          {'money':10.00, 'detail':'优惠2000金币', 'gold':198000},
          {'money':50.00, 'detail':'优惠40000金币', 'gold':960000}
        ],
        'isTrue':false
      },
      'wechat':{
        'data':[
          {'money':1.00, 'detail':'金额越大越优惠', 'gold':20000},
          {'money':10.00, 'detail':'优惠2000金币', 'gold':198000},
          {'money':50.00, 'detail':'优惠40000金币', 'gold':960000}
        ],
        'isTrue':false
      },
      'huafei':{
        'data':[
          {'money':1.00, 'detail':'金额越大越优惠', 'gold':20000},
          {'money':10.00, 'detail':'优惠2000金币', 'gold':198000},
          {'money':50.00, 'detail':'优惠40000金币', 'gold':960000}
        ],
        'isTrue':false
      }
    } 

    this.dataArr['zhifubao']['selectIndx'] = -1;
    this.dataArr['wechat']['selectIndx'] = -1;
    this.dataArr['huafei']['selectIndx'] = -1;

    // 'xx':[0, 1, 2, 3], 'nn':'aa'}
    this.objectKeys = Object.keys(this.dataArr);
    // console.log(Object.keys(this.dataArr));

    this.tempData = this.dataArr['zhifubao']['data'];

    // let aa = {'xx':[0, 1, 2, 3], 'nn':'aa'}
  }

  selectPageMenu(index) {
    console.log("点击...."+index)
    this.selectIndex = index;
    this.contentSlides.slideTo(index, 500, false);
  }

  slideChanged() {
    let index = this.contentSlides.getActiveIndex();
    this.selectIndex = index;
  }

  selctMoney(index) {
    this.moneySelect = index;
  }

}
